#include "ti_msp_dl_config.h"
#include "ti/driverlib/dl_adc12.h"
#include "Oled.h"
#include "Motor.h"
#include "Oled_ui.h"
#include "Encoder.h"
#include "Huiduo.h"
#include "Bsp.h"

int main(void)
{
    SYSCFG_DL_init();
    OLED_Init();   
    Jy61p_Init();
    timer_init();
    encoder_init();
    Huidu_Init();
    DL_Timer_startCounter(TIMG0);
    DL_Timer_startCounter(TIMG6);
    DL_Timer_startCounter(TIMG7);
    DL_Timer_startCounter(TIMG8);
    OLED_Pu();
    Set_Angle();
    Start_Pid();
    //Get_Pid(-10.6, 0.00, 0, 32, 92, 0, 0.000, 92, 0, 0.000, 10, 0, 0);
    //Get_Pid(35.6, 0.3, 0, 11, 262, 0, 0.420, 262, 0, 0.420, 40.7, 0.0, 0.3);
    
    while(1)
    {
        (( g_current_mode > 1)&&(counter.count > 0)) ? Sg() : 0 ;
        OLED_ShowFloatNum(0, 16, SAngle.Angle[2], 3, 1, OLED_8X16);
        OLED_ShowNum(0,32,counter.count,1,OLED_8X16);
        OLED_ShowFloatNum(32, 32, Encoder.countr, 3, 1, OLED_8X16);
        OLED_ShowFloatNum(0, 48, PID.Median, 3, 1, OLED_8X16);
        OLED_Update();
    }
}